//
//  STShouldEditCell.m
//  YiYueHairdresser
//
//  Created by YYLPro3 on 2018/11/7.
//  Copyright © 2018 YuYiLian. All rights reserved.
//

#import "STShouldEditCell.h"

@implementation STShouldEditCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupSubview];
    }
    return self;
}
-(void)setupSubview
{
    UIButton *editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [editBtn setTitle:@"前往编辑" forState:UIControlStateNormal];
    [editBtn setTitleColor:LightGrayTextColor forState:UIControlStateNormal];
    editBtn.titleLabel.font = FONT(13);
    [editBtn setImage:[UIImage imageNamed:@"info-more"] forState:UIControlStateNormal];
    [editBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 20)];
    [editBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 80, 0, 0)];
    
    [editBtn addTarget:self action:@selector(editAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:editBtn];
    
    [editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView.mas_centerX);
        make.width.mas_equalTo(120);
        make.height.mas_equalTo(40);
    }];
}
-(void)editAction:(UIButton *)btn
{
    if (_editDelegate && [_editDelegate respondsToSelector:@selector(hairShouldEditDelegate:)]) {
        [_editDelegate hairShouldEditDelegate:self.editIndexPath];
    }
}
@end
